<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%customer}}".
 *
 * @property int $customer_id
 * @property int $store_id
 * @property string $firstname
 * @property string $lastname
 * @property string $email
 * @property string $telephone
 * @property string $fax
 * @property string $password
 * @property string $salt
 * @property string $cart
 * @property string $wishlist
 * @property int $newsletter
 * @property int $address_id
 * @property int $customer_group_id
 * @property string $ip
 * @property int $status
 * @property int $approved
 * @property string $token
 * @property string $date_added
 * @property int $sale 该用户所属销售0:未分组，1:颜阳阳  2:邱博  3:侯军  4:张丽坤 5:刘建伟依次累加
 * @property int $invitation_group_id
 * @property int $city_code
 * @property int $mis_id mis的ID
 */
class Customer extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%customer}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['store_id', 'newsletter', 'address_id', 'customer_group_id', 'status', 'approved', 'sale', 'invitation_group_id', 'city_code', 'mis_id'], 'integer'],
            [['firstname', 'lastname', 'email', 'telephone', 'fax', 'password', 'salt', 'customer_group_id', 'status', 'approved', 'token'], 'required'],
            [['cart', 'wishlist'], 'string'],
            [['date_added'], 'safe'],
            [['firstname', 'lastname', 'telephone', 'fax'], 'string', 'max' => 32],
            [['email'], 'string', 'max' => 96],
            [['password', 'ip'], 'string', 'max' => 40],
            [['salt'], 'string', 'max' => 9],
            [['token'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'customer_id' => Yii::t('app', 'Customer ID'),
            'store_id' => Yii::t('app', 'Store ID'),
            'firstname' => Yii::t('app', 'Firstname'),
            'lastname' => Yii::t('app', 'Lastname'),
            'email' => Yii::t('app', 'Email'),
            'telephone' => Yii::t('app', 'Telephone'),
            'fax' => Yii::t('app', 'Fax'),
            'password' => Yii::t('app', 'Password'),
            'salt' => Yii::t('app', 'Salt'),
            'cart' => Yii::t('app', 'Cart'),
            'wishlist' => Yii::t('app', 'Wishlist'),
            'newsletter' => Yii::t('app', 'Newsletter'),
            'address_id' => Yii::t('app', 'Address ID'),
            'customer_group_id' => Yii::t('app', 'Customer Group ID'),
            'ip' => Yii::t('app', 'Ip'),
            'status' => Yii::t('app', 'Status'),
            'approved' => Yii::t('app', 'Approved'),
            'token' => Yii::t('app', 'Token'),
            'date_added' => Yii::t('app', 'Date Added'),
            'sale' => Yii::t('app', 'Sale'),
            'invitation_group_id' => Yii::t('app', 'Invitation Group ID'),
            'city_code' => Yii::t('app', 'City Code'),
            'mis_id' => Yii::t('app', 'Mis ID'),
        ];
    }
}
